package cn.oowoo.jsr303.common.dto;

import lombok.Data;

import javax.validation.constraints.*;

@Data
public class Relatives {
    @NotNull(groups = JSR303Dto.Update.class)
    @Null(groups = JSR303Dto.Add.class)
    private Integer userId;

    @NotNull(groups = JSR303Dto.Add.class)
    @Size(min = 2,max = 8,message = "姓名必须是2-8位长度",groups = {JSR303Dto.Update.class, JSR303Dto.Add.class})
    private String realName;

    @NotBlank(groups = JSR303Dto.Add.class)
    @Pattern(regexp = "^((17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$",message = "手机号码不合法",groups = {JSR303Dto.Update.class, JSR303Dto.Add.class})
    private String phone;
}
